package org.zero.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import lombok.SneakyThrows;
import org.springframework.core.convert.converter.Converter;

/**
 * 字符串转日期
 *
 * @author Zero
 */
public class DateConverter implements Converter<String, Date> {

    @SneakyThrows
    @Override
    public Date convert(String s) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return dateFormat.parse(s);
    }
}
